<html>
<head><meta charset="utf-8"><title>the new Async trait means remaking rust async from scratch · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/the.20new.20Async.20trait.20means.20remaking.20rust.20async.20from.20scratch.html">the new Async trait means remaking rust async from scratch</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="245520135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/the%20new%20Async%20trait%20means%20remaking%20rust%20async%20from%20scratch/near/245520135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dario Nieuwenhuis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/the.20new.20Async.20trait.20means.20remaking.20rust.20async.20from.20scratch.html#245520135">(Jul 10 2021 at 00:28)</a>:</h4>
<p>I would like to take a step back and look at the big picture of the proposed changes, since most discussions get bogged down with the details of  "how to do X?" instead of "should we do X?".</p>
<p>To me, the big picture of the proposed changes look like throwing away the existing async and remaking it from scratch. Most notable is the new <code>Async</code> trait.  The new <code>Async</code> trait will inevitably result in breaking the entire ecosystem. Why?</p>
<ol>
<li><code>Async</code> is <em>more powerful</em>. It can do a few things <code>Future</code> can't regarding cancellation. This means at least some libraries will choose to return <code>Async</code>s instead of <code>Future</code>s.</li>
<li><code>Async</code> is <em>infectious</em>. Everything that touches an <code>Async</code> needs to be <code>Async</code> itself. You can't poll an <code>Async</code> from a <code>Future</code>. Any <code>async fn</code> that awaits an <code>Async</code> will need to return an <code>Async</code> instead of a <code>Future</code>.</li>
</ol>
<p>Therefore <code>Async</code> will become the new standard and will *push Future out of relevance`. </p>
<ul>
<li>Everything will end up being an <code>Async</code></li>
<li>All executors will switch to execute <code>Async</code>s because their users now have <code>Async</code>s.</li>
<li>We may then pretend <code>Future</code> has never existed. It may even get deprecated. <code>Async</code> is Rust Async 2.0. <code>Future</code> is Rust Async 1.0</li>
</ul>
<p>Why is this bad?  This is not "technical breakage", since technically all old code still compiles and runs. It's what let's call "cognitive breakage".</p>
<ul>
<li>There's now the "old deprecated way" and the "new way". New devs will wtill have to learn that the old way exists and to avoid it. This makes learning async rust harder. They'll run into old blog posts, tutorials and crates using <code>Futures</code>.</li>
<li>All existing code using <code>Future</code> will be worthless.</li>
</ul>
<p>The end result is a "Rust async 2.0" ecosystem completely incompatible with the current one. The current one goes to the trash.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>